import VueRouter from 'vue-router'

import about from "@/pages/About.vue";
import home from "@/pages/Home.vue";
import news from "@/pages/News.vue";
import message from "@/pages/Message.vue";
import detail from "@/pages/Detail.vue";
//创建并暴露VueRouter对象
export default new VueRouter({
    routes:[
        {
            path:'/about',
            component:about
        },
        {
            path:'/home',
            component:home,
            //在这个配置项里面加入子路径
            children:[
                {
                    // 注意这里的路径不要带/
                    path:'news',
                    component:news
                },
                {
                    path:'message',
                    component:message,
                    children:[
                        {
                            // 给路径命名 使用时传入一个对象指定名字即可
                            name:'detail',
                            path:'detail',
                            component:detail
                        }
                    ]
                }
            ]
        }
    ]
})